<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('服务商审核列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
        <div class="row">
            <div class="col-sm-12 search-collapse">
                <form id="formId">
                    <div class="select-list">
                        <ul>
                            <li>
                                <label>用户昵称：</label>
                                <input type="text" name="userNickname"/>
                            </li>
                            <li>
                                <label style="width: 120px;">用户手机号：</label>
                                <input type="text" name="userPhone"/>
                            </li>
                            <li>
                                <label>用户类型：</label>
                                <input type="text" name="isServiceuser"/>
                            </li>
                            <li>
                                <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                                <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                            </li>
                        </ul>
                    </div>
                </form>
            </div>

            <div class="btn-group-sm" id="toolbar" role="group">
              <!--  <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="lm:user:add">
                    <i class="fa fa-plus"></i> 添加
                </a>-->
                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="lm:user:edit">
                    <i class="fa fa-edit"></i> 修改
                </a>
               <!-- <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="lm:user:remove">
                    <i class="fa fa-remove"></i> 删除
                </a>
                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="lm:user:export">
                    <i class="fa fa-download"></i> 导出
                </a>-->
            </div>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table"></table>
            </div>
        </div>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('lm:user:edit')}]];
        var removeFlag = [[${@permission.hasPermi('lm:user:remove')}]];
        var prefix = ctx + "lm/userreview";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                exportUrl: prefix + "/export",
                modalName: "用户",
                columns: [{
                    checkbox: true
                },
                {
                    field: 'id',
                    title: '主键',
                    visible: false
                },
                    {
                        field: 'isGeren',
                        title: '个人',
                        visible: false
                    },
                    {
                        field: 'isQiye',
                        title: '企业',
                        visible: false
                    },
                {
                    field: 'userNickname',
                    title: '用户昵称',
                    formatter: function(value, row, index) {
                        return $.table.tooltip(value);
                    }
                },
                {
                    field: 'userPic',
                    title: '用户头像',
                    formatter: function(value, row, index) {
                        return $.table.imageView(value);
                    }
                },
                {
                    field: 'userPhone',
                    title: '用户手机号'
                },
                {
                    field: 'userInventioncode',
                    title: '用户邀请码'
                },
                {
                    field: 'userBalance',
                    title: '账户余额'
                },
                {
                    field: 'userType',
                    title: '用户类型'
                },
                {
                    field: 'userImg',
                    title: '身份证正面',
                    formatter: function(value, row, index) {
                        var actions = [];
                        if(row.userImg != null){
                            actions.push('<a  href="javascript:void(0)" onclick="openVinPic(\'' + row.userImg + '\')">查看</a> ');
                        }
                        return actions.join('');
                    }
                },
                {
                    field: 'userImgback',
                    title: '身份证反面',
                    formatter: function(value, row, index) {
                        var actions = [];
                        if(row.userImgback != null){
                            actions.push('<a  href="javascript:void(0)" onclick="openVinPic(\'' + row.userImgback + '\')">查看</a> ');
                        }
                        return actions.join('');
                    }
                },
                {
                    field: 'userLicense',
                    title: '营业执照',
                    formatter: function(value, row, index) {
                        var actions = [];
                        if(row.userLicense != null){
                            actions.push('<a  href="javascript:void(0)" onclick="openVinPic(\'' + row.userLicense + '\')">查看</a> ');
                        }
                        return actions.join('');
                    }
                },
                {
                    field: 'gerenSt',
                    title: '个人认证状态'
                },
                    {
                        field: 'qiyeSt',
                        title: '企业认证状态'
                    },
                {
                    field: 'packageTimes',
                    title: '剩余次数'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        if(row.gerenSt == "审核中" || row.qiyeSt =="审核中"){

                            actions.push('<a class="btn btn-primary btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="review(\'' + row.id + '\')"><i class="fa fa-edit"></i>通过</a> ');
                            actions.push('<a class="btn btn-warning btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="reviewDis(\'' + row.id + '\')"><i class="fa fa-edit"></i>不通过</a> ');
                        }
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
            };
            $.table.init(options);
        });

        function openVinPic(userLicense){
            $.modal.open("查看图片", userLicense);
        }

        function review(id) {
            debugger;
            $.ajax({
                type: "post",
                url: ctx + "lm/user/reviewUser?id="+id,
                success: function(r) {
                    $.modal.msgSuccess("审批成功");
                }
            });
            $("#bootstrap-table").bootstrapTable('refresh', {
                silent: true
            });
        }
        function reviewDis(id) {
            debugger;
                $.modal.open('审批拒绝', prefix + "/review/"+id, '900', '320');
           /* $.ajax({
                type: "post",
                url: ctx + "lm/user/reviewUserDis?id="+id,
                success: function(r) {
                    $.modal.msgSuccess("审批成功");
                }
            });
            $("#bootstrap-table").bootstrapTable('refresh', {
                silent: true
            });*/
        }

    </script>
</body>
</html>